﻿Imports System.Data.OleDb


Public Class maintenanceDiscussionAdd
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If System.Web.HttpContext.Current.User.Identity.IsAuthenticated Then


        Else
            Response.Redirect("maintenanceDiscussionAdd.aspx")
        End If







    End Sub

    Protected Sub btnsubmit_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnsubmit.Click
        Dim sql As String = "INSERT INTO Maintenance_Discussion (Title,DateCreated,Website,UserIDFK) VALUES (@f1,@f2,@f3,@f4)"
        Dim conn As OleDbConnection = New OleDbConnection(ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString)
        Dim cmd As OleDbCommand = New OleDbCommand(sql, conn)

        cmd.Parameters.AddWithValue("@f1", txtMaintenanceDescription.Text)
        cmd.Parameters.AddWithValue("@f2", Now.Date.ToString("dd/MM/yyyy"))
        cmd.Parameters.AddWithValue("@f3", txtrelatedwebsite.Text)
        cmd.Parameters.AddWithValue("@f4", Membership.GetUser(User.Identity.Name).ProviderUserKey)

        conn.Open()
        cmd.ExecuteNonQuery()
        conn.Close()
        cmd.Dispose()
        conn.Dispose()
        Response.Redirect("maintenanceDiscussionAdd.aspx")




    End Sub
End Class